<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a  id="aa"> 点我</a>
<input  id="bn" type="button" value="设置属性">
<script>
      var bn = document.getElementById("bn");
       bn.onclick=function(){
           var aa = document.getElementById("aa");
            aa.setAttribute("href","https://www.baidu.com");
       }

</script>

</body>
</html>